import regexp from '@/utils/constants/regexp'

export const requireRuleItem = {
  required: true,
  message: '必填项',
  trigger: ['blur', 'change'],
}
export const phoneRuleItem = {
  pattern: regexp.mobile,
  message: '请输入11位手机号',
  trigger: ['blur', 'change'],
}
export const emailRuleItem = {
  pattern: regexp.email,
  message: '请输入正确的邮箱',
  trigger: ['blur', 'change'],
}
export const requiredRule = (field) => {
  return {
    [field]: [requireRuleItem],
  }
}
export const phoneRule = (field) => {
  return {
    [field]: [phoneRuleItem],
  }
}
export const emailRule = (field) => {
  return {
    [field]: [emailRuleItem],
  }
}
